package br.com.unifebe.tcc.DAO;

import java.util.Collection;

import org.hibernate.Session;
import org.hibernate.Transaction;

import br.com.unifebe.tcc.UTILS.HibernateUtils;
import br.com.unifebe.tcc.model.Usuario;
@SuppressWarnings( "unchecked")
public class UsuarioDAO extends DAOimpl<Usuario> {

	private static UsuarioDAO instance;
	
	public static UsuarioDAO getInstance(){
		if(instance == null){
			instance = new UsuarioDAO();
		}
		return instance;
	}
	
	@Override
	public Collection<Usuario> getListaTodos() {
		Session session = HibernateUtils.getSessionFactory().openSession();
		Transaction t = session.beginTransaction();
		Collection<Usuario> lista = session.createCriteria(Usuario.class).list();
		t.commit();
		return lista;
	}
	
}
